home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2008 January / Cybermycha 1_2008.iso / Data.cab / _4DC8B96D74E248DBA7E2F0DD3C2284DB < prev    next >
Encoding:
Text File  |  2004-05-27  |  1.7 KB  |  89 lines

  1.  
  2. regc(2, "COMBINED_XFORM")
  3. regc(6, "MODEL_XFORM")
  4.  
  5. regc(12, "FOG_PARAMS")
  6.  
  7. regc(13, "CAMERA_POS_MS")
  8. regcn(14, "DIRECTIONAL_DIR_MS", 0)
  9.  
  10. regc(20, "TEXTURE2_XFORM")
  11. regc(24, "TEXTURE3_XFORM")
  12.  
  13. regc4f(30, 0.0, 0.0, 0.0, %sunvisibility)
  14. // ------------ c40 - c60 reserved
  15. !include("vs_spot_consts.inc")
  16.  
  17. vshader("
  18.  
  19. #define point        v0
  20. #define normal        v1
  21. #define tangent        v2
  22. #define tcoord        v3
  23.  
  24. #define fogp    c12
  25. #define cpos    c13
  26. #define ldir    c14
  27.  
  28.     vs_1_1
  29.  
  30. #include    <cardef.h>
  31. #include    <fog.inc>
  32.  
  33.     def c0, SPECULARPOW, 0, 0, 0
  34.  
  35.     dcl_position    point
  36.     dcl_normal    normal
  37.     dcl_tangent    tangent
  38.     dcl_texcoord    tcoord
  39.  
  40.     ; output position
  41.     m4x4    oPos, point, c2
  42.  
  43.     ; E in model space
  44.     add r2, cpos, -point
  45.     ; normalize E
  46.     dp3 r2.w, r2, r2
  47.     rsq r2.w, r2.w
  48.     mul r2.xyz, r2, r2.w
  49.  
  50.     ; reflect E
  51.     dp3 r5.w, r2, normal
  52.     add r6.w, r5.w, r5.w
  53.     mad r6.xyz, normal, r6.w, -r2 // dot(E, N)*2 *N - E
  54.  
  55.     ; output cubemap
  56.     m3x3    oT3, -r6, c24
  57.  
  58.     dp3        r4.x, normal, ldir        ; diffuse N*L
  59.     dp3        r4.y, ldir, r6        ; specular L*R
  60.     mov        r4.w, c0.x              ; specular pow
  61.     lit        r3, r4
  62.  
  63.     ; output diffuse
  64.     mov        oD0.w, r3.y   //  sun
  65.     ; output specular
  66.     mul        oD1, r3.z, c30.w    //sunvisibility
  67.  
  68. ;------------------------------------------
  69. // spot lights
  70. // used r0 - r2
  71. #if VS_SPOTLIGHTS
  72. #include <vs_spot_func.inc>
  73. #endif
  74. ;----------------------------
  75.     ; output texcoords
  76.     mov        oT0, tcoord           // color
  77.     mov     oT1, tcoord        // dirt
  78.     mov     oT3, tcoord        // broken
  79.  
  80.     ; terrain lightmap texgen (from model space)
  81.     dp4        oT2.x, point, c20
  82.     dp4        oT2.y, point, c21
  83.  
  84.     ; calc fog
  85.        dp4    r0.x, point, c4
  86.        FOG(r0.x, fogp, r10)
  87. ")
  88.  
  89.